﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SysComm;
using Resources;


public partial class IPMSMasterPage : System.Web.UI.MasterPage
{
    private void SetMenuTitle()
    {
        menu1ProjectReminder.InnerText = ISitemap.Reminder;
        menu1ProjectReminder1.InnerText = ISitemap.Reminder;
        menu1ProjectGroupManage.InnerText = ISitemap.ProjectGroupManage;
        menu1NewProjectGroup.InnerText = ISitemap.NewProjectGroup;
        menu1ProjectGroupList.InnerText = ISitemap.ProjectGroupList;
        menu1ProjectManage.InnerText = ISitemap.ProjectManage;
        menu1ProjectList.InnerText = ISitemap.ProjectList;
        menu1ProductManage.InnerText = ISitemap.ProductList;
        menu1NewProduct.InnerText = ISitemap.NewProduct;
        menu1ProductList.InnerText = ISitemap.ProductList;
        menu1Search.InnerText = ISitemap.Search;
        menu1ProjectSearch.InnerText = ISitemap.ProjectSearch;
        menu1ProjectDocumentUploadInquiry.InnerText = ISitemap.ProjectDocumentUploadInquiry;
        menu1Setting.InnerText = ISitemap.Settings;
        menu1ProcedureSetup.InnerText = ISitemap.ProcedureSetup;
        menu1ProcedureSection.InnerText = ISitemap.ProcedureSection;
        menu1ProcedureSet.InnerText = ISitemap.ProcedureSet;
        menu1ProcedureTemplate.InnerText = ISitemap.ProcedureTemplate;
        menu1ProcedureSetTemplate.InnerText = ISitemap.ProcedureSetTemplate;
        menu1DocumentSetup.InnerText = ISitemap.DocumentSetup;
        menu1DocumentSection.InnerText = ISitemap.DocumentSection;
        menu1DocumentType.InnerText = ISitemap.DocumentType;
        menu1MaintenanceFiles.InnerText = ISitemap.MaintenanceFiles;
        menu1ProjectClass.InnerText = ISitemap.ProjectClass;
        menu1Agents.InnerText = ISitemap.Agents;
        menu1Clients.InnerText = ISitemap.Clients;
        menu1Countries.InnerText = ISitemap.Countries;
        menu1UserSettings.InnerText = ISitemap.UserSettings;
        menu1UserGroupsManage.InnerText = ISitemap.UserGroupManagement;
        menu1UsersManage.InnerText = ISitemap.UsersManage;
        menu1SysMaintenance.InnerText = ISitemap.SysMaintenance;
        menu1SystemLog.InnerText = ISitemap.SystemLog;
        menu1UpdateHistory.InnerText = ISitemap.UpdateHistory;

        menu2SysMaintenance.InnerText = ISitemap.SysMaintenance;
        menu2SystemLog.InnerText = ISitemap.SystemLog;
        menu2UpdateHistory.InnerText = ISitemap.UpdateHistory;

        menu3ProjectReminder.InnerText = ISitemap.Reminder;
        menu3ProjectReminder1.InnerText = ISitemap.Reminder;
        menu3ProjectGroupManage.InnerText = ISitemap.ProjectGroupManage;
        menu3NewProjectGroup.InnerText = ISitemap.NewProjectGroup;
        menu3ProjectGroupList.InnerText = ISitemap.ProjectGroupList;
        menu3ProjectManage.InnerText = ISitemap.ProjectManage;
        menu3ProjectAdd.InnerText = ISitemap.ProjectAdd;
        menu3ProjectList.InnerText = ISitemap.ProjectList;
        menu3ProductManage.InnerText = ISitemap.ProductList;
        menu3NewProduct.InnerText = ISitemap.NewProduct;
        menu3ProductList.InnerText = ISitemap.ProductList;
        menu3Search.InnerText = ISitemap.Search;
        menu3ProjectSearch.InnerText = ISitemap.ProjectSearch;
        menu3ProjectDocumentUploadInquiry.InnerText = ISitemap.ProjectDocumentUploadInquiry;
        menu3Setting.InnerText = ISitemap.Settings;
        menu3ProcedureSetup.InnerText = ISitemap.ProcedureSetup;
        menu3ProcedureSection.InnerText = ISitemap.ProcedureSection;
        menu3ProcedureSet.InnerText = ISitemap.ProcedureSet;
        menu3ProcedureTemplate.InnerText = ISitemap.ProcedureTemplate;
        menu3ProcedureSetTemplate.InnerText = ISitemap.ProcedureSetTemplate;
        menu3DocumentSetup.InnerText = ISitemap.DocumentSetup;
        menu3DocumentSection.InnerText = ISitemap.DocumentSection;
        menu3DocumentType.InnerText = ISitemap.DocumentType;
    }


    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Session[SysUtil.m_str_session_userid] == null)
        {
            base.Response.Redirect("~/SysLogin.aspx");
        }
        this.lblUserName.Text = this.Session[SysUtil.m_str_session_username].ToString();
        string strUserGroupID = Session[SysUtil.m_str_session_usergroupid].ToString();
        SetMenuTitle();

        if (strUserGroupID == "1")
        {
            SiteMapDataSource1.SiteMapProvider = "AspNetXmlSiteMapProvider";
            div_sitemap1.Visible = true;
            div_sitemap2.Visible = false;
            div_sitemap3.Visible = false;
        }
        else if (strUserGroupID == "2")
        {
            SiteMapDataSource1.SiteMapProvider = "AspNetXmlSiteMapProvider1";
            div_sitemap1.Visible = false;
            div_sitemap2.Visible = true;
            div_sitemap3.Visible = false;
        }
        else
        {
            SiteMapDataSource1.SiteMapProvider = "AspNetXmlSiteMapProvider2";
            div_sitemap1.Visible = false;
            div_sitemap2.Visible = false;
            div_sitemap3.Visible = true;
        }
        
    }


    protected void OnClick(object sender, EventArgs e)
    {
        if (sender == btnChangePassword)
        {
            Response.Redirect("SysChangePasswd.aspx");
        }
        else if (sender == btnLogout)
        {
            Session[SysUtil.m_str_session_userid] = null;
            base.Response.Redirect("~/SysLogin.aspx");
        }
    }
}
